package gcontent.entities.content.image;

import gcontent.entities.Content;
import gcontent.entities.Site;
import gcontent.entities.content.error.ContentEx;
import gcontent.record.error.RecordEx;

public class ContentImage extends Content {
	
	public static final String TYPE_IMAGE = "image/*";
	
	public ContentImage()
	{
		super();
	}
	
	public void setFormat(String format)
	{
		int sep;
		
		sep = format.indexOf('/');
		if(sep > -1) {
			format = format.substring(sep + 1, format.length());
		}
		
		this.format = format;
	}
	
	public void save() throws RecordEx, ContentEx
	{		
		this.id = (Integer)this.record.execProc("PROC_CreateContentImage", 
				  null,
				  null,			
				  this.format,
				  this.body,
				  this.body == null? 0 : this.body.length,
				  this.last_modified,
				  this.truncated
				  );
									  								
	}
}
